package com.wgf.controller;

import com.wgf.utils.DateTimeTools;
import com.wgf.utils.ExpressTools;
import jakarta.annotation.Resource;
import org.springframework.ai.chat.client.ChatClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import reactor.core.publisher.Flux;

@RestController
public class ExpressController
{
    @Resource
    private ChatClient chatClient;

    @GetMapping("/expresstool/chat")
    public Flux<String> chat(String msg)
    {
        return chatClient
                .prompt(msg)
                .tools(new ExpressTools(), new DateTimeTools())
                .stream()
                .content();
    }
}